﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace test5
{
    public class Rect
    {
        double width;
        double height;
        public Rect(double width, double height)
        {
            this.width = width;
            this.height = height;
        }
        public Rect()
        {
            width = 10;
            height = 10;
        }
        public double area()
        {
            return width * height;
        }
        public double perimeter()
        {
            return 2 * (width + height);
        }
    }
    public class PlainRect
    {
        double width;
        double height;
        public double startX { get; set; }
        public double startY { get; set; }
        public PlainRect()
        {
            startX = 0;
            startY = 0;
        }
        public PlainRect(double x, double y, double h, double w)
        {
            startX = x;
            startY = y;
            height = h;
            width = w;
        }
        public bool isInside(double x, double y)
        {
            if (x >= startX && startX <= startX + height && y >= startY && y <= startY + width)
                return true;
            else
                return false;
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            Rect rect = new Rect(20,10);
            Console.WriteLine("面积为"+rect.area());
            Console.WriteLine("周长为"+rect.perimeter());
            PlainRect pr = new PlainRect(10, 10, 20, 10);
            if (pr.isInside(25.5, 13))
            {
                Console.WriteLine("这个点在矩形内");
            }
            else
                Console.WriteLine("这个点不在矩形内");
        }
    }
}